<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:pe="http://primefaces.org/ui/extensions"
      xmlns:hr="http://java.sun.com/jsf/composite/autocomplete">

    <h:body>

        <ui:composition template="/resources/template/template.xhtml">

            <ui:define name="content">

                <h:form>
                    <p:panel header="Employe Retired Report" >

                        <h:panelGrid columns="2">  
                            <h:outputLabel value="Time Range"/>
                            <p:selectOneRadio value="#{hrReportController.reportKeyWord.string}" >
                                <f:selectItem itemLabel="3 Months" itemValue="0" />
                                <f:selectItem itemLabel="6 Months" itemValue="1" />
                                <f:selectItem itemLabel="9 Months" itemValue="2" />
                                <f:selectItem itemLabel="12 Months" itemValue="3" />
                            </p:selectOneRadio>
                        </h:panelGrid>
                        <h:panelGrid columns="3">
                            <p:commandButton ajax="false" action="#{hrReportController.createRetiedStaffs}" value="Fill" />
                            <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" style="float: right;" >
                                <p:printer target="reportPrint"  />
                            </p:commandButton>
                            <p:commandButton ajax="false" value="Excel" styleClass="noPrintButton" style="float: right;" >
                                <pe:exporter type="xlsx" target="tbl2" fileName="hr_report_employee_detail"  />
                            </p:commandButton> 
                        </h:panelGrid>

                        <p:panel  id="reportPrint" styleClass="noBorder summeryBorder">


                            <p:dataTable value="#{hrReportController.staffs}" 
                                         var="s" 
                                         id="tbl2" 
                                         rowIndexVar="i"
                                         rowKey="#{s.id}"

                                         >
                                <f:facet name="header">
                                    
                                    <h:outputLabel value="Employee List"/>
                                    <h:panelGroup rendered="#{hrReportController.reportKeyWord.institution ne null}" >
                                        <br/>
                                        <h:outputLabel value="#{hrReportController.reportKeyWord.institution.name}" />
                                        <br/>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{hrReportController.reportKeyWord.department ne null}" >
                                        <h:outputLabel value="Department : #{hrReportController.reportKeyWord.department.name}"/>
                                        <br/>
                                    </h:panelGroup>
                                    <h:panelGroup rendered="#{hrReportController.reportKeyWord.roster ne null}" >
                                        <h:outputLabel value="Roster : #{hrReportController.reportKeyWord.roster.name}"/>
                                        <br/>
                                    </h:panelGroup>
                                </f:facet>
                                <p:column headerText="Id" filterBy="#{s.id}" exportable="false" rendered="false">
                                    #{s.id}
                                </p:column>
                                <p:column headerText="Code NO" sortBy="#{s.codeInterger}" style="max-width: 15px;">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Code NO" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.codeInterger}" />
                                </p:column>
                                <p:column headerText="EPF Code" style="max-width: 15px;" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="EPF Code" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.epfNo}" />
                                </p:column>
                                <p:column filterBy="#{s.person.name}" headerText="Name">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Name" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.person.name}" />
                                </p:column>
<!--                                <p:column headerText="Full Name" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Full Name" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.person.fullName}" />
                                </p:column>
                                <p:column headerText="Name with Initials" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Name with Initials" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.person.nameWithInitials}" />
                                </p:column>-->
                                <p:column headerText="Speciality" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Speciality" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.speciality.name}" />
                                </p:column>

                                <p:column headerText="Roster" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Roster" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.roster.name}" />
                                </p:column>

<!--                                <p:column headerText="Working Time For Over Time Per Week" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Working Time For Over Time Per Week" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.workingTimeForOverTimePerWeek}" />
                                </p:column>

                                <p:column headerText="Working Time For NoPay Per Week" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Working Time For Over Time Per Week" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.workingTimeForNoPayPerWeek}" />
                                </p:column>-->

                                <p:column headerText="Employee Status">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Employee Status" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.employeeStatus.label}" />
                                </p:column>
                                <p:column headerText="ADDRESS" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="ADDRESS" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.person.address}" />
                                </p:column>
                                <p:column headerText="Sex" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Sex" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.person.sex}" />
                                </p:column>
                                <p:column headerText="NIC No" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="NIC No" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.person.nic}" />
                                </p:column>
                                <p:column headerText="DOB" sortBy="#{s.person.dob.month}" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="DOB" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.person.dob}" >
                                        <f:convertDateTime pattern="dd MM yyyy" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="DO Join" sortBy="#{s.dateJoined}" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="DO Join" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.dateJoined}" >
                                        <f:convertDateTime pattern="dd MM yyyy" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="DO Retierd" sortBy="#{s.dateRetired}" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="DO Retierd" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.dateRetired}" >
                                        <f:convertDateTime pattern="dd MM yyyy" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="DO Resign" sortBy="#{s.dateLeft}" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="DO Resign" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.dateLeft}" >
                                        <f:convertDateTime pattern="dd MM yyyy" />
                                    </p:outputLabel>
                                </p:column>
                                <p:column headerText="DEPARTMENT" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="DEPARTMENT" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.workingDepartment.name}" />
                                </p:column>
<!--                                <p:column headerText="Account Number" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Account Number" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.accountNo}" />
                                </p:column>
                                <p:column headerText="Bank" >
                                    <f:facet name="header" >
                                        <p:outputLabel value="Bank" />
                                    </f:facet>
                                    <p:outputLabel value="#{s.bankBranch.institution.name}" />
                                </p:column>-->
                                <f:facet name="footer">
                                    <p:outputLabel value="Print By : #{sessionController.loggedUser.webUserPerson.name} - " />
                                    <p:outputLabel value="Print At : " />
                                    <p:outputLabel value="#{commonController.currentDateTime}" >
                                        <f:convertDateTime pattern="yyyy MMMM dd hh:mm:ss a " />
                                    </p:outputLabel>
                                </f:facet>

                            </p:dataTable>


                        </p:panel>
                    </p:panel>
                </h:form>
            </ui:define>


        </ui:composition>

    </h:body>
</html>
